package com.mes.basicdata.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.context.annotation.Lazy;

import com.mes.common.domain.BasicModel;

/**
 * <p>
 * 
 * </p>
 * 
 * <p>
 * Created on 2009-07
 * </p>
 * 
 * @author lhy
 * 
 */
@Entity()
//@org.hibernate.annotations.Entity(dynamicInsert=true,dynamicUpdate=true)
@Table(name = "B_XBOM_DETAIL")
@BatchSize(size=10)
@Lazy(value=true)
@Cache(usage=CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class XbomDetail extends BasicModel implements java.io.Serializable {
	
	@Id
	@GenericGenerator(name = "uniqueId", strategy = "assigned")
	@Column(name="UNIQUEID",unique=true)
	private String uniqueId;
	
	@Column(name="XBOMUID")
	protected String xbomUid;
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="XBOMUID",insertable=false,updatable=false)
	protected Xbom xbom;
	
	@Column(name="PARENT_PART_NUMBER")
	protected String parentPartUid; 
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="PARENT_PART_NUMBER",insertable=false,updatable=false)
	protected Part parentPart;
	
	@Column(name="CHILD_PART_NUMBER")
	protected String childPartUid;
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="CHILD_PART_NUMBER",insertable=false,updatable=false)
	protected Part childPart;
	
	@Column(name="CHILD_QTY")
	protected Integer childQty;
	
	@Column(name="IS_CRITICAL")
	protected Integer isCritical;
	
	@Column(name="READYPOINT")
	protected Integer readyPoint;
	
	// 是否有效
	@Column(name="EFFECTIVE")
	private Boolean effective;

	// 
	@Column(name="SUB_XBOMUID")
	protected String subXbomUid;
	
	@Override
	public String getUuid() {
		return this.getUniqueId();
	}
	@Override
	public void setUuid(String uuid) {
		this.setUniqueId(uuid);
	}
	
	public String getUniqueId() {
		return uniqueId;
	}

	public void setUniqueId(String uniqueId) {
		this.uniqueId = uniqueId;
	}

	public String getXbomUid() {
		return xbomUid;
	}

	public void setXbomUid(String xbomUid) {
		this.xbomUid = xbomUid;
	}

	public Xbom getXbom() {
		return xbom;
	}

	public void setXbom(Xbom xbom) {
		this.xbom = xbom;
	}

	public String getParentPartUid() {
		return parentPartUid;
	}

	public void setParentPartUid(String parentPartUid) {
		this.parentPartUid = parentPartUid;
	}

	public Part getParentPart() {
		return parentPart;
	}

	public void setParentPart(Part parentPart) {
		this.parentPart = parentPart;
	}

	public String getChildPartUid() {
		return childPartUid;
	}

	public void setChildPartUid(String childPartUid) {
		this.childPartUid = childPartUid;
	}

	public Part getChildPart() {
		return childPart;
	}

	public void setChildPart(Part childPart) {
		this.childPart = childPart;
	}

	public Integer getChildQty() {
		return childQty;
	}

	public void setChildQty(Integer childQty) {
		this.childQty = childQty;
	}

	public Integer getIsCritical() {
		return isCritical;
	}

	public void setIsCritical(Integer isCritical) {
		this.isCritical = isCritical;
	}

	public Integer getReadyPoint() {
		return readyPoint;
	}

	public void setReadyPoint(Integer readyPoint) {
		this.readyPoint = readyPoint;
	}

	public Boolean getEffective() {
		return effective;
	}

	public void setEffective(Boolean effective) {
		this.effective = effective;
	}
	public String getSubXbomUid() {
		return subXbomUid;
	}
	public void setSubXbomUid(String subXbomUid) {
		this.subXbomUid = subXbomUid;
	}
	
	

}